package com.sl.au.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.User;
import com.sl.au.entity.ViewForVisitorReward;
import com.sl.au.entity.VisitorReward;
import com.sl.au.entity.VisitorRewardProcessing;

public interface ViewForVisitorRewardRepository extends JpaRepository<ViewForVisitorReward, String> {
	
	@Query("select u from ViewForVisitorReward u where (u.sex like %?1% or u.contactType like %?1% or u.name like %?1%) and u.role=?2 ")
	Page<ViewForVisitorReward> getPageBykey(String key,String role, Pageable pageable);
	
	@Query("select count(u) from ViewForVisitorReward u where (u.sex like %?1% or u.contactType like %?1% or u.name like %?1%) and u.role=?2 ")
	int getPageBykeyCount(String key,String role);

	@Query("select u from ViewForVisitorReward u where u.role=?1 ")
	Page<ViewForVisitorReward> getPage(String role, Pageable pageable);
	
	@Query("select count(u) from ViewForVisitorReward u where u.role=?1 ")
	int getPageCount(String role);
	
	
}
